package models.mappers;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import models.Role;
import models.RoleUser;

public interface RoleUserMapper {
	/**
	 * 获取已启用角色列表
	 *
	 * @Title: getRole 
	 * @return
	 * @return: List<Role>
	 */
	@Select("select roleid,rolename from "
			+ Role.TABLE_NAME
			+" where isflag=0")
	List<Role> getRole();
	/**
	 * 根据角色id获取角色用户
	 *
	 * @Title: getRoleOperator 
	 * @param roleid
	 * @return
	 * @return: List<String>
	 */
	@Select("select userid from "
			+ RoleUser.TABLE_NAME
			+" where roleid=#{roleid}")
	List<String> getRoleOperator(String roleid);
	/**
	 * 保存角色用户
	 *
	 * @Title: saveRoleUser 
	 * @param smap
	 * @return
	 * @return: boolean
	 */
	boolean saveRoleUser(Map<String, List<RoleUser>> smap);
	/**
	 * 删除角色用户
	 *
	 * @Title: deleteRoleUser 
	 * @param roleid
	 * @return: void
	 */
	@Delete("delete from "
			+ RoleUser.TABLE_NAME
			+" where roleid=#{roleid}")
	void deleteRoleUser(String roleid);
	
}
